﻿/*******************************************************************************
 * Copyright @ 2017 YunSpace.Framework 版权所有
 * Author: GaoTang
 * Description: YunSpace 快速开发平台
 * Website：http://www.yunspace.com.cn
*********************************************************************************/
#region USING SYSTEM
using System.Collections.Generic;
using YunSpace.Data;
using YunSpace.Domain.Entity.WorkFlow;
#endregion

namespace YunSpace.Domain.IRepository.WorkFlow
{
    public interface IDictionaryRepository
    {
        /// <summary>
        /// 新增
        /// </summary>
        int Add(DictionaryEntity model);

        /// <summary>
        /// 更新
        /// </summary>
        int Update(DictionaryEntity model);

        /// <summary>
        /// 查询所有记录
        /// </summary>
        List<DictionaryEntity> GetAll();

        /// <summary>
        /// 查询单条记录
        /// </summary>
        DictionaryEntity Get(string id);

        /// <summary>
        /// 删除
        /// </summary>
        int Delete(string id);

        /// <summary>
        /// 查询记录条数
        /// </summary>
        long GetCount();


        /// <summary>
        /// 查询根记录
        /// </summary>
        DictionaryEntity GetRoot();

        /// <summary>
        /// 查询下级记录
        /// </summary>
        List<DictionaryEntity> GetChilds(string id);

        /// <summary>
        /// 查询下级记录
        /// </summary>
        List<DictionaryEntity> GetChildsByCode(string code);

        /// <summary>
        /// 查询上级记录
        /// </summary>
        DictionaryEntity GetParent(string id);

        /// <summary>
        /// 是否包含下级记录
        /// </summary>
        bool HasChilds(string id);

        /// <summary>
        /// 得到最大排序
        /// </summary>
        int GetMaxSort(string id);

        /// <summary>
        /// 更新排序
        /// </summary>
        int UpdateSort(string id, int sort);

        /// <summary>
        /// 根据代码查询一条记录
        /// </summary>
        DictionaryEntity GetByCode(string code);
    }
}

